package com.biu.billiards.controller;


import com.biu.billiards.model.vo.shop.orderAdmin.AddOrderAdminVo;
import com.biu.billiards.model.vo.shop.orderAdmin.GetOrderAdminVo;
import com.biu.billiards.model.vo.shop.orderAdmin.UpdateOrderAdminVO;
import com.biu.billiards.model.vo.shop.GetShopVo;
import com.biu.billiards.response.BaseResponse;
import com.biu.billiards.response.RespGenerator;
import com.biu.billiards.service.IOrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xue
 * @since 2023-09-25
 */
@RestController
@RequestMapping()
public class OrderController {

    @Resource
    private IOrderService orderService;




    @ApiOperation(value = "allListShopSum")
    @PostMapping("/allListShopSum")
    public BaseResponse<Map<String,Object>> allListShopSum(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(orderService.allListShopSum(getShopVo));
    }

    @ApiOperation(value = "allListSum")
    @PostMapping("/allListSum")
    public BaseResponse<Map<String,Object>> allListSum(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(orderService.allListSum(getShopVo));
    }


    @ApiOperation(value = "allSum")
    @PostMapping("/allSum")
    public BaseResponse<Map<String,Object>> allSum() {
        return RespGenerator.returnOK(orderService.allSum());
    }


    @ApiOperation(value = "获取饼图")
    @PostMapping("/getPieInfo")
    public BaseResponse<Map<String,Object>> getPieInfo(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(orderService.getPieInfo(getShopVo));
    }


    @ApiOperation(value = "获取流水")
    @PostMapping("/getStreamInfo")
    public BaseResponse<Map<String,Object>> getStreamInfo(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(orderService.getStreamInfo(getShopVo));
    }

    @ApiOperation(value = "获取订单数据")
    @PostMapping("/getOrderPage")
    public BaseResponse<Map<String,Object>> getOrderPage(@RequestBody GetOrderAdminVo getOrderVo) {
        return RespGenerator.returnOK(orderService.getOrderPage(getOrderVo));
    }


    @ApiOperation(value = "修改订单信息")
    @PutMapping("/updateOrder")
    public BaseResponse<Boolean> updateOrder(@RequestBody UpdateOrderAdminVO updateOrderVO) {
        return RespGenerator.returnOK(orderService.updateOrder(updateOrderVO));
    }


    @ApiOperation(value = "新增订单信息")
    @PostMapping("/addOrder")
    public BaseResponse<Boolean> addOrder(@RequestBody AddOrderAdminVo addOrderVo) {
        return RespGenerator.returnOK(orderService.addOrder(addOrderVo));
    }


    @ApiOperation(value = "删除订单信息")
    @DeleteMapping("/deleteOrder")
    public BaseResponse<Boolean> deleteOrder(@RequestParam("orderId") String orderId) {
        return RespGenerator.returnOK(orderService.deleteOrder(orderId));
    }

}
